package com.neusoft.rental.mapper;

import com.neusoft.rental.po.Goodsappointment;
import com.neusoft.rental.po.Placeappointment;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface GoodsappointmentMapper {

    //增加物资申请
    @Insert("insert into goodsappointment values(#{goodsid},#{userid},#{starttime},#{endtime}," +
            "#{rentnum},#{reason},null,0)")
    public int addGoodsappointment(Goodsappointment goodsappointment);

    //sql语句请看mapper文件夹中xml文件
    //管理员查询物资申请,用户查询审核通过的物资申请
    public List<Goodsappointment> getGoodsappointment(Goodsappointment goodsappointment);

    //sql语句请看mapper文件夹中xml文件
    //实现两个功能，一、管理员进行审核，judge为1表示院级审核通过，judge为2表示校级审核通过，二、用户归还物资
    public int judgeGoodsappointment(Goodsappointment goodsappointment);

    //管理员拒绝申请，删除该申请
    @Delete("delete from goodsappointment where userid=#{userid} and goodsid=#{goodsid} " +
            "and starttime=#{starttime} and endtime=#{endtime}")
    public int deleteGoodsappointment(Goodsappointment goodsappointment);
}
